<?php
/* @var $this BaivietController */
/* @var $model Baiviet */
/* @var $form CActiveForm */
?>

<div class="form">
    <script src="<?php echo Yii::app()->baseUrl. '/ckeditor/ckeditor.js'; ?>"></script>
    <?php
    $form = $this->beginWidget('CActiveForm', array(
        'id' => 'baiviet-form',
        // Please note: When you enable ajax validation, make sure the corresponding
        // controller action is handling ajax validation correctly.
        // There is a call to performAjaxValidation() commented in generated controller code.
        // See class documentation of CActiveForm for details on this.
        'enableAjaxValidation' => false,
        'htmlOptions' => array('enctype' => 'multipart/form-data'),
    ));
    ?>

    <p class="note">Fields with <span class="required">*</span> are required.</p>

        <?php echo $form->errorSummary($model); ?>

    <div class="row">
        <?php echo $form->labelEx($model, 'Tiêu đề bài viết'); ?>
        <?php echo $form->textArea($model, 'tieudebaiviet', array('rows' => 2, 'cols' => 40)); ?>
        <?php echo $form->error($model, 'tieudebaiviet'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'anhminhhoa'); ?>
        <?php echo CHtml::image(Yii::app()->request->baseUrl. '/images/anhbaiviet/' .$model->anhminhhoa,"anhminhhoa", array("width"=>300,"heigth"=>700)); ?>
        <br/>
        <?php echo CHtml::activeFileField($model, 'anhminhhoa'); ?>
        <?php echo $form->error($model, 'anhminhhoa'); ?>
        
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'Tóm tắt'); ?>
        <?php echo $form->textArea($model, 'tomtat', array('rows' => 4, 'cols' => 98)); ?>
        <?php echo $form->error($model, 'tomtat'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'Nội dung'); ?>
        <?php echo $form->textArea($model, 'noidung', array('class'=>'ckeditor')); ?>
        <?php echo $form->error($model, 'noidung'); ?>
    </div>
    

    <div class="row">
        <?php echo $form->labelEx($model, 'Loại Tin'); ?>
        <?php echo Qlhelper::selectidloatin($model->IDloaitin) ?>
        <?php echo $form->error($model, 'IDloaitin'); ?>
    </div>

    <div class="row">
        <?php echo $form->labelEx($model, 'Trạng Thái'); ?>
        <?php echo $form->dropDownList($model, 'trangthai', $model->getTrangthai()); ?>
        <?php echo $form->error($model, 'trangthai'); ?>
    </div>
    
    <div class="row">
        <?php echo $form->labelEx($model, 'Bài viết đặc biệt'); ?>
        <?php echo $form->checkBox($model, 'baivietdacbiet'); ?>
        <?php echo $form->error($model, 'baivietdacbiet'); ?>
    </div>


    <script>
        $(function () {
            $("#anim").change(function () {
                $("#datepicker").datepicker("option", "showAnim", $(this).val());
            });
        });
    </script>
    <div class="row">
        <?php echo $form->labelEx($model, 'Ngày đăng'); ?>

        <?php
        $this->widget('zii.widgets.jui.CJuiDatePicker',array(
            'attribute'=>'ngaydang',
            'model'=>$model,
            'value'=>date('m-d-Y'),    
            'options'=>array(
                'showAnim'=>'slideDown',//'slide','fold','slideDown','fadeIn','blind','bounce','clip','drop'
                'showButtonPanel'=>true,
            ),
            'htmlOptions'=>array(
                'style'=>''
            ),
        ));
        ?>
<?php echo $form->error($model, 'ngaydang'); ?>
    </div>

    <div class="row buttons">
    <?php echo CHtml::submitButton($model->isNewRecord ? 'Create' : 'Save'); ?>
    </div>
    

<?php $this->endWidget(); ?>
<script>
	 CKEDITOR.replace( 'noidung',
	  {
	   filebrowserBrowseUrl :'http://localhost/testsqlite/fileckeditor/js/ckeditor/filemanager/browser/default/browser.html?Connector=http://kodemaster.co.cc/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php',
	   filebrowserImageBrowseUrl : 'http://localhost/testsqlite/fileckeditor/js/ckeditor/filemanager/browser/default/browser.html?Type=Image&Connector=http://kodemaster.co.cc/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php',
	   filebrowserFlashBrowseUrl :'http://localhost/testsqlite/fileckeditor/js/ckeditor/filemanager/browser/default/browser.html?Type=Flash&Connector=http://kodemaster.co.cc/filemanager_in_ckeditor/js/ckeditor/filemanager/connectors/php/connector.php',
	   filebrowserUploadUrl  :'http://localhost/testsqlite/fileckeditor/js/ckeditor/filemanager/connectors/php/upload.php?Type=File',
	   filebrowserImageUploadUrl : 'http://localhost/testsqlite/fileckeditor/js/ckeditor/filemanager/connectors/php/upload.php?Type=Image',
	   filebrowserFlashUploadUrl : 'http://localhost/testsqlite/fileckeditor/js/ckeditor/filemanager/connectors/php/upload.php?Type=Flash'
	  });
</script>
</div><!-- form -->